package org.wattdepot.cli.commands;

import org.wattdepot.util.tstamp.Tstamp;

/**
 * Checks if input is in XMLGregorianCalendar format.
 * 
 * @author David Joel Lazaro
 * 
 */
public class TStampChecker {

  /**
   * Checks if the timestamp is correct.
   * 
   * @param input String literal of the user inputed timestamp.
   * @return true if correct, false if not.
   */
  public boolean checkTStamp(String input) {

    try {
      Tstamp.makeTimestamp(input);
      return true;
    }
    catch (Exception e) {
      System.out.println("ERROR: " + input + " is not a valid timestamp");
      return false;
    }
  }
}
